package cn.boyu.result;

import cn.boyu.exception.LogicException;
import org.springframework.util.StringUtils;

public class AssertUtil {
    /*
    * 断言两个字符串是否相等
    * v1和v2是要比较的两个字符串 ，msg是不相同议程的错误信息
    * */
    public static void isEquals(String v1,String v2,String msg){
        if (v1==null || v2==null){
            throw new LogicException("参数不能为null");
        }
        if (!v1.equals(v2)){
            throw new LogicException(msg);
        }
    }

    public static void hasLength(String text,String message){
        if (!StringUtils.hasLength(text)){
            throw new LogicException(message);


        }
    }



}
